package com.nowcoder.code.hjnc;

public class NC156 {

    public int foundOnceNumber(int[] arr, int k) {

        int[] ss = new int[32];
        for (int i = 0; i < arr.length; i++) {
            for (int j = 31; j >= 0; j--) {
                ss[j] = ss[j] + (arr[i] & 0x1);
                arr[i] >>>= 1;
            }
        }
        int res = 0;
        for (int i = 0; i < 32; i++) {
            res = res << 1;
            res = res | ss[i] % k;
        }

        return res;
    }

    public static void main(String[] args) {
        int[] is = {0,0,-119,0,0,-119,99,-132,-119,-119,-119,0,-132,-132,-132,-132};
        System.out.println(new NC156().foundOnceNumber(is,5));

    }

}
